/*
 * @Author: your name
 * @Date: 2021-10-19 14:50:25
 * @LastEditTime: 2021-10-19 14:59:44
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /a1902-a-group/vue_router/src/utils/filterRouter.js
 */

/**
 * @description: 筛选路由表 根据不同的author 展示不同的路由表
 * @param {routerList} 所有的路由表
 * @param {author} 权限 USER / TC
 * @return {*}
 */
export const filterRouter = (routerList, author) => {
    const res = routerList.filter((item) => {
        return item.meta.author.indexOf(author) !== -1;
    })
    res.length && res.forEach((item) => {
        if(item.children) {
            item.children = filterRouter(item.children, author)
        }
    })

    return res;

}